import { View } from "../../../../mvc/core/View";
import { LayerManager } from "../../../manager/LayerManager";
import { GSprite } from "../../../../../com/mui/controls/GSprite";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { SkillCombinationRenderer } from "./SkillCombinationRenderer";
import { ScrollPolicy } from "../../../../../flashx/textLayout/container/ScrollPolicy";
import { SoundManager } from "../../../../common/sound/SoundManager";
import { SoundTypeConst } from "../../../../common/sound/SoundTypeConst";
import { CopyConfig } from "../../../resource/CopyConfig";
import { DataProvider } from "../../../../../fl/data/DataProvider";
import { Global } from "../../../../../com/gengine/global/Global";
import { GTileList } from "../../../../../com/mui/controls/GTileList";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class SkillCombinationList
    
    export  class SkillCombinationList extends View
    {
        constructor()
        {
            super();
            this.init();
            layer = LayerManager.windowLayer;
            return;
        }

        /* internal  */init(): void
        {
            this._sp = new GSprite();
            addChild(this._sp);
            this._sp.addEventListener(flash.events.MouseEvent.MOUSE_DOWN, this.onMoveMouseDown);
            var loc1=ObjCreate.createBg(0, 0, 335, 445, this, ImagesConst.ToolTipBg);
            this._sp.addChildAt(loc1, 0);
            this._skillList = ObjCreate.createTileList(10, 10, 325, 430, this);
            this._skillList.columnWidth = 308;
            this._skillList.rowHeight = 108;
            this._skillList.setStyle("cellRenderer", SkillCombinationRenderer);
            this._skillList.horizontalScrollPolicy = ScrollPolicy.OFF;
            this._skillList.verticalScrollPolicy = ScrollPolicy.OFF;
            this.updateList();
            this._closeBtn = ObjCreate.createGButton("", 295, 8, 19, 19, this._sp, "CloseButton");
            this._closeBtn.focusEnabled = true;
            this._closeBtn.name = "Window_Btn_Close";
            this._closeBtn.configEventListener(flash.events.MouseEvent.CLICK, this.closeBtnClickHandler);
            return;
        }

        protected closeBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            SoundManager.instance.soundPlay(SoundTypeConst.UIclose);
            hide();
            return;
        }

        /* internal  */updateList(): void
        {
            var loc1=CopyConfig.instance.getCurCopySkillList(190);
            this._skillList.dataProvider = new DataProvider(loc1);
            return;
        }

        /* internal  */onMoveMouseDown(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (arg1.currentTarget == this._sp || arg1.target == this._sp) 
            {
                this.startDrag();
                Global.stage.addEventListener(flash.events.MouseEvent.MOUSE_UP, this.onStageMouseUpHandler);
            }
            return;
        }

        /* internal  */onStageMouseUpHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.stopDrag();
            Global.stage.removeEventListener(flash.events.MouseEvent.MOUSE_UP, this.onStageMouseUpHandler);
            return;
        }

        /* internal */ /* var */_skillList: GTileList;

        /* internal */ /* var */_closeBtn: GButton;

        /* internal */ /* var */_sp: GSprite;
    }
